﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_ManufactureList.cshtml";
}
<script type="text/javascript">
    var status = '@ViewBag.status';
    var number = '@ViewBag.number';
    $(function () {
        initControl();
    });
    function initControl() {
        if (status == 'U') {
            if ($('#oldEntity').val() != '') {
                var data = JSON.parse($('#oldEntity').val());
                setDataByJson("#form1", data);
            }
            $('#FContainerNO').prop("readonly", true);
        }
        initBindSelect("#form1");
    }
    function btn_ok() {
        submitForm();
    }
    function submitForm() {
        var OutlineSize1 = $('#OutlineSize1').val();
        var OutlineSize2 = $('#OutlineSize2').val();
        var OutlineSize3 = $('#OutlineSize3').val();
        var OutlineSize = "";
        if (OutlineSize1 != '') {
            OutlineSize += OutlineSize1;
            if (OutlineSize2 != '') {
                OutlineSize += "x" + OutlineSize2;
                if (OutlineSize3 != '') {
                    OutlineSize += "x" + OutlineSize3;
                }
            }
        }
        $('#OutlineSize').val(OutlineSize);
        var InnerSize1 = $('#InnerSize1').val();
        var InnerSize2 = $('#InnerSize2').val();
        var InnerSize3 = $('#InnerSize3').val();
        var InnerSize = "";
        if (InnerSize1 != '') {
            InnerSize += InnerSize1;
            if (InnerSize2 != '') {
                InnerSize += "x" + InnerSize2;
                if (InnerSize3 != '') {
                    InnerSize += "x" + InnerSize3;
                }
            }
        }
        $('#InnerSize').val(InnerSize);
        if (!$('#form1').formValid()) {
            return false;
        }
        $.submitForm({
            url: "/MainData/Container/SubmitContainerListForm?status=" + status + "&keyValue=" + number,
            param: $("#form1").formSerialize(),
            success: function (result) {
                if (status == 'I') {
                    parent.reloadGrid(result.data);
                } else {
                    parent.reloadGrid();
                }
                parent.$.detailClose();
            }
        })
    }
    function btn_cancel() {
        parent.$.detailClose();
    }
</script>
<div class="ui-layout" id="layout" style="height: 96%; width: 100%;">
    <input id="oldEntity" type="hidden" value="@ViewBag.oldEntity" />
    <form id="form1">
        <div style="width:900px;margin:0 auto;">
            <table class="form" style="width:900px;text-align:right;margin:15px;border-bottom:2px solid #ccc;">
                <tr>
                    <td class="formValue input-width-185" style="width:500px;padding-left:100px;text-align:left;">
                        &nbsp;
                    </td>
                    <td style="width: 300px; padding: 5px 10px;">
                        <div class="btn-group" style="margin-right:20px;">
                            <a id="" class="btn btn-primary center-block" onclick="btn_ok()"><span class="glyphicon glyphicon-ok"></span> 确认</a>
                        </div>
                        <div class="btn-group">
                            <a id="" class="btn btn-primary center-block" onclick="btn_cancel()"><span class="glyphicon glyphicon-remove"></span> 取消</a>
                        </div>
                    </td>
                </tr>
            </table>
            <table class="form" style="width: 900px;">
                <tr>
                    <th class="formTitle" style="width:120px;">容器编号</th>
                    <td class="formValue input-width-210" style="width:220px;">
                        <input id="FContainerNO" name="FContainerNO" type="text" class="form-control required" value="" />
                        <input id="FContainerID" name="FContainerID" type="hidden" value="" />
                    </td>
                    <th class="formTitle" style="width:90px;">&nbsp;</th>
                    <td class="formValue">
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">容器名称</th>
                    <td class="formValue input-width-320" colspan="3">
                        <input id="FContainerName" name="FContainerName" type="text" class="form-control required" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">容器分类</th>
                    <td class="formValue input-width-210">
                        <select id="FContainerTypeNO" name="FContainerTypeNO" class="form-control required">
                            <option value="">&nbsp;</option>
                            @foreach (var item in ViewBag.containerType)
                            {
                                <option value="@item.FTypeNO">@item.FTypeNO @item.FTypeName</option>
                            }
                        </select>
                    </td>
                    <th class="formTitle">叠加层次</th>
                    <td class="formValue input-width-105">
                        <input id="FLayerCount" name="FLayerCount" type="text" class="form-control text-right digits" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">外形尺寸(mm)</th>
                    <td class="formValue input-width-40">
                        <input id="OutlineSize" name="OutlineSize" type="hidden" value="" />
                        <input id="OutlineSize1" name="OutlineSize1" type="text" class="form-control text-right number" value="" /><label class="suffix" style="font-size:18px;">&times;</label>
                        <input id="OutlineSize2" name="OutlineSize2" type="text" class="form-control text-right number" value="" /><label class="suffix" style="font-size:18px;">&times;</label>
                        <input id="OutlineSize3" name="OutlineSize3" type="text" class="form-control text-right number" value="" />
                    </td>
                    <th class="formTitle">数量(套)</th>
                    <td class="formValue input-width-105">
                        <input id="FContainerSum" name="FContainerSum" type="text" class="form-control text-right digits" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">内形尺寸(mm)</th>
                    <td class="formValue input-width-40">
                        <input id="InnerSize" name="InnerSize" type="hidden" value="" />
                        <input id="InnerSize1" name="InnerSize1" type="text" class="form-control text-right number" value="" /><label class="suffix" style="font-size:18px;">&times;</label>
                        <input id="InnerSize2" name="InnerSize2" type="text" class="form-control text-right number" value="" /><label class="suffix" style="font-size:18px;">&times;</label>
                        <input id="InnerSize3" name="InnerSize3" type="text" class="form-control text-right number" value="" />
                    </td>
                    <th class="formTitle">容器重量</th>
                    <td class="formValue input-width-105">
                        <input id="FContainerWeight" name="FContainerWeight" type="text" class="form-control text-right number" value="" /><label class="suffix" style="font-size:14px;">kg</label>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">制造日期</th>
                    <td class="formValue input-width-185" colspan="3">
                        <input id="ProductDate" name="ProductDate" type="text" onclick="WdatePicker()" class="form-control input-wdatepicker" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">备注说明</th>
                    <td class="formValue input-width-740" colspan="3">
                        <input id="Fdesc" name="Fdesc" type="text" class="form-control" value="" />
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>

